for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
import Backbone from 'backbone';
import {
Backgrid
} from './core.js';
Columns
} from './columns.js';
HeaderRow
} from './header_row.js';
/**
Header is a special structural view class that renders a table head with a
single row of header cells.
@class Backgrid.Header
@extends Backbone.View
*/
var Header = Backgrid.Header = Backbone.View.extend({
/** @property */
tagName: "thead",
Initializer. Initializes this table head view to contain a single header
row view.
@param {Object} options
@param {Backbone.Collection.<Backgrid.Column>|Array.<Backgrid.Column>|Array.<Object>} options.columns Column metadata.
@param {Backbone.Model} options.model The model instance to render.
@throws {TypeError} If options.columns or options.model is undefined.
initialize: function (options) {
this.columns = options.columns;
if (!(this.columns instanceof Backbone.Collection)) {
this.columns = new Columns(this.columns);
}
this.row = new HeaderRow({
columns: this.columns,
collection: this.collection
});
},
Renders this table head with a single row of header cells.
render: function () {
this.$el.append(this.row.render().$el);
this.delegateEvents();
return this;
Clean up this header and its row.
@chainable
remove: function () {
this.row.remove.apply(this.row, arguments);
return Backbone.View.prototype.remove.apply(this, arguments);
export {
Header
};